import random
money=5000
num = random.randint(1, 100)
while money>0:
    guess_num = int(input("请输入一个整数："))
    while num!=guess_num:
        if num>guess_num and money>0:
            print("输小了")
            money=money-500
            print("您目前积分为：{}".format(money))
            guess_num=int(input("请重新输入一个整数："))
        elif(num<guess_num and money>0):
            print("输大了")
            money = money - 500
            print("您目前积分为：{}".format(money))
            guess_num = int(input("请重新输入一个整数："))
        else:
            print("余额不足")
            break
    else:
        print("恭喜猜中，本轮幸运数字：{}".format(num))
        money=money+3000
        print("您目前积分为：{}".format(money))
        print("是否进行下一轮游戏：yes/no")
        result=input()
        while result!='yes' and result!='no':
            print("请重新输入")
            result = input()
        else:
            if  result=='no':
                break
            elif result=='yes':
                continue


